package com.coocare.licence.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.coocare.licence.entity.SysRole;
import com.coocare.licence.entity.SysUser;
import com.coocare.licence.entity.dto.UserDTO;
import com.coocare.licence.entity.dto.UserInfo;
import com.coocare.licence.entity.dto.UserRoleAssignDTO;
import com.coocare.licence.utils.PageDomain;
import com.coocare.licence.utils.PageUtils;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 服务类
 * </p>
 *
 * @author adam
 * @since 2023-10-10
 */
public interface ISysUserService extends IService<SysUser> {

    Map<String, Object> login(String username, String password);

    PageUtils queryPage(String searchWord, Boolean status, PageDomain pageDomain);

    SysUser queryUserByName(String username);

    Long saveUser(UserDTO userDTO);

    /**
     * 初始化密码
     *
     * @param userId
     * @return
     */
    Boolean resetPassword(Long userId);

    Boolean changeUserPass(String oldPass, String newPass);

    Boolean updateUser(UserDTO userDTO);

    /**
     * 状态切换
     *
     * @param id
     * @param status
     * @return
     */
    Boolean change(Long id, Boolean status);

    /**
     * 分配角色
     *
     * @return
     */
    Object assignRoles(UserRoleAssignDTO dto);

    /**
     * 获取登录用户的信息
     *
     * @param userId
     * @return
     */
    UserInfo userInfo(Long userId);

    /**
     * 获取用户角色
     *
     * @param id
     * @return
     */
    List<SysRole> getRolesByUser(Long id);

    Boolean checkPassword(String password);
}
